1. Technical Field
This disclosure generally relates to computer software, and more specifically relates to ways for processing an aspect-oriented program.
2. Background Art
Object-oriented programming was developed to enhance the reusability of code by dividing the code into modular chunks called objects. An object may contain data along with methods that may be called to perform desired operations. An object has a defined interface for accessing its methods and data, which enhances reusability of the object because the internal implementation of the object may be changed without affecting the interface. The implementation of an object is said to be “encapsulated” within the object. The result is objects in a program that cooperate to perform the desired functions of the program, while potentially allowing the objects to be reused for other programs.
One problem that was discovered in object-oriented programs is the difficulty of generating objects that are truly reusable across many different programs. One thing that makes object-oriented programs less reusable is functions (or concerns) that cut across many different objects. For example, logging is an example of a crosscutting concern, because a logging strategy necessarily affects every single logged part of the system. Logging thereby crosscuts all logged classes and methods in an object-oriented program.
A new paradigm known as aspect-oriented programming was developed that allows crosscutting concerns to be encapsulated in one place, thereby enhancing the reusability of the code. In an aspect-oriented program, an aspect can alter the behavior of the base program (the non-aspect part of a program) by applying advice (additional behavior) at various join points (points in a program) specified in a quantification or query called a pointcut (that detects whether a given join point matches). A join point specifies where an advice can potentially run. Join points are points in a program where additional behavior can be usefully joined. Pointcuts are ways to specify join points. Pointcuts determine whether a given join point matches. Advice is typically contained within an aspect. Advice is a means for specifying code that contains additional behavior to run at a join point. The combination of pointcuts and advices in aspects that are separate from the base program allows crosscutting concerns to be implemented in an aspect-oriented program in a clean and modular way.
Current aspect-oriented compilers work on base programs and aspects that are in the same Java Virtual Machine (JVM), that is, they assume the base program and the aspect call each other using same-JVM method calls. While this works fine for many applications, it is not ideal when advice needs to be located remotely, such as in a distributed computing system. To communicate with advice that is located remotely, current aspect-oriented compilers require the programmer to place code in the base program that establishes a connection and invokes the advice remotely. This manual insertion of code by a programmer to access remote advice decreases the modularity and reusability of the program, and may cause portability problems if a specific communication protocol is used. Without a way to access remote advice in a way that does not negatively affect the reusability and portability of the program, the software industry will continued to be hampered by requiring that programmers insert code in the base program to handle remote access to advice.